
import 'dart:convert';

AssignmentOperation assignmentOperationFromJson(String str) => AssignmentOperation.fromJson(json.decode(str));

String assignmentOperationToJson(AssignmentOperation data) => json.encode(data.toJson());

class AssignmentOperation {
    AssignmentOperation({
        this.operationType,
        this.id,
        this.allStudentInClass,
        this.extraPoints,
        this.instruction,
        this.name,
        this.settings,
        this.endDate,
        this.startDate,
        this.workType,
        this.noOfBookToBeRead,
        this.studentUserNames,
        this.bookIds,
    });

    String? operationType;
    String? id;
    bool? allStudentInClass;
    int? extraPoints;
    dynamic instruction;
    String? name;
    SimpleSettings? settings;
    String? endDate;
    String? startDate;
    String? workType;
    int? noOfBookToBeRead;
    List<StudentUserName>? studentUserNames;
    List<BookId>? bookIds;

    factory AssignmentOperation.fromJson(Map<String, dynamic> json) => AssignmentOperation(
        operationType: json["operationType"],
        id: json["id"],
        allStudentInClass: json["allStudentInClass"],
        extraPoints: json["extraPoints"],
        instruction: json["instruction"],
        name: json["name"],
        settings: json["settings"]!=null ? SimpleSettings.fromJson(json["settings"]) : null,
        endDate: json["endDate"],
        startDate: json["startDate"],
        workType: json["workType"],
        noOfBookToBeRead: json["noOfBookToBeRead"],
        studentUserNames: json["studentUserNames"]!=null ? List<StudentUserName>.from(json["studentUserNames"].map((x) => StudentUserName.fromJson(x))) : null,
        bookIds:json["bookIds"]!=null ? List<BookId>.from(json["bookIds"].map((x) => BookId.fromJson(x))) : null,
    );

    Map<String, dynamic> toJson() => {
        "operationType": operationType,
        "id": id,
        "allStudentInClass": allStudentInClass,
        "extraPoints": extraPoints,
        "instruction": instruction,
        "name": name,
        "settings": settings!=null ? settings?.toJson():null,
        "endDate": endDate,
        "startDate": startDate,
        "workType": workType,
        "noOfBookToBeRead": noOfBookToBeRead,
        "studentUserNames":studentUserNames!=null ? List<dynamic>.from(studentUserNames!.map((x) => x.toJson())) : null,
        "bookIds":bookIds!=null ? List<dynamic>.from(bookIds!.map((x) => x.toJson())):null,
    };
}

class BookId {
    BookId({
        this.id,
        this.title,
    });

    String? id;
    String? title;

    factory BookId.fromJson(Map<String, dynamic> json) => BookId(
        id: json["id"],
        title: json["title"],
    );

    Map<String, dynamic> toJson() => {
        "id": id,
        "title": title,
    };
}

class SimpleSettings {
    SimpleSettings({
        this.audio,
        this.lang,
        this.language,
        this.pinyin,
        this.quizAudio,
    });

    bool? audio;
    String? lang;
    String? language;
    bool? pinyin;
    bool? quizAudio;

    factory SimpleSettings.fromJson(Map<String, dynamic> json) => SimpleSettings(
        audio: json["audio"],
        lang: json["lang"],
        language: json["language"],
        pinyin: json["pinyin"],
        quizAudio: json["quizAudio"],
    );

    Map<String, dynamic> toJson() => {
        "audio": audio,
        "lang": lang,
        "language": language,
        "pinyin": pinyin,
        "quizAudio": quizAudio,
    };
}

class StudentUserName {
    StudentUserName({
        this.value,
        this.label,
    });

    String? value;
    String? label;

    factory StudentUserName.fromJson(Map<String, dynamic> json) => StudentUserName(
        value: json["value"],
        label: json["label"],
    );

    Map<String, dynamic> toJson() => {
        "value": value,
        "label": label,
    };
}
